home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / m17n / vi-base.mim < prev    next >
Text File  |  2009-04-29  |  5KB  |  134 lines

  1. ;; vi-base.mim -- Provide bases for Vietnamese Input method
  2. ;; Copyright (C) 2008
  3. ;;   National Institute of Advanced Industrial Science and Technology (AIST)
  4. ;;   Registration Number H15PRO112
  5.  
  6. ;; This file is part of the m17n database; a sub-part of the m17n
  7. ;; library.
  8.  
  9. ;; The m17n library is free software; you can redistribute it and/or
  10. ;; modify it under the terms of the GNU Lesser General Public License
  11. ;; as published by the Free Software Foundation; either version 2.1 of
  12. ;; the License, or (at your option) any later version.
  13.  
  14. ;; The m17n library is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. ;; Lesser General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU Lesser General Public
  20. ;; License along with the m17n library; if not, write to the Free
  21. ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. ;; Boston, MA 02110-1301, USA.
  23.  
  24. (input-method t nil vi-base)
  25.  
  26. (description "Provide bases for Vietnamese input methods.
  27. This is acutually not a standalone input method, but is expected
  28. to be included in the other Vietnamese input method (e.g. vi-telex, vi-vni).
  29. ")
  30.  
  31. ;;; Usage of variables:
  32. ;;; M (mark): point after the last vowel
  33. ;;; T (mark): point after the tone-mark-attached vowel
  34. ;;; TPLACE: On which vowel a tone is attached (0:none, 1:1st, 2:2nd, or 3:3rd)
  35. ;;; C: The initial consonant
  36. ;;; V-1: The last vowel
  37. ;;; V-2: The second from the last vowel (or 0 if there aren't two vowels)
  38. ;;; V-3: The third from the last vowel (or 0 if there aren't three vowels)
  39. ;;; C-AFTER-V: Number of the final consonants
  40. ;;; SELECT: Which tone is selected
  41.  
  42. (macro
  43.  (handle-mark
  44.   ;; At first, cancel the tone mark if already put.
  45.   (move T) (select 0)
  46.   (move M)
  47.   (cond (V-3
  48.      ;; Tripple-vowel
  49.      ;; Put a tone mark on the last vowel if it is ├¬, or ╞í.
  50.      ;; Otherwise put a tone mark on the second vowel.
  51.      (cond ((| (= V-1 ?├¬) (= V-1 ?╞í) (= V-1 ?├è) (= V-1 ?╞á))
  52.         (set TPLACE 3))
  53.            (1 (move @-) (set TPLACE 2))))
  54.     (V-2
  55.      ;; Double-vowel
  56.      ;; Put a tone mark on the last vowel in the following cases:
  57.      ;;  * The last vowel is  ├ó, ─â, ├¬, ├┤, ╞í, ╞░, or ╞░ (i.e. non-ASCII).
  58.      ;;  * The initial consonant and the first vowel is "gi" or "qu".
  59.      ;;  * tone-mark-on-last is customized to 1 in such equivocal
  60.      ;;    cases as "oa", "oe", "oo", and "uy".
  61.      ;; Otherwise put a tone mark on the first vowel.
  62.      (cond ((| (> V-1 127)
  63.            (& (| (= C ?g) (= C ?G)) (| (= V-2 ?i) (= V-2 ?I)))
  64.            (& (| (= C ?q) (= C ?Q)) (| (= V-2 ?u) (= V-2 ?U)))
  65.            (& (| tone-mark-on-last (> C-AFTER-V 0))
  66.               (| (& (| (= V-2 ?o) (= V-2 ?O))
  67.                 (| (= V-1 ?a) (= V-1 ?A) (= V-1 ?e) (= V-1 ?E)
  68.                    (= V-1 ?o) (= V-1 ?O)))
  69.              (& (| (= V-2 ?u) (= V-2 ?U))
  70.                 (| (= V-1 ?y) (= V-1 ?Y))))))
  71.         (set TPLACE 2))
  72.            (1 (move @-) (set TPLACE 1))))
  73.     (1 (set TPLACE 1)))
  74.   (select SELECT)
  75.   (mark T)
  76.   (move @>)))
  77.  
  78. (map
  79.  ;; These must be defined in each input method.
  80.  ;; (vowel-ext)
  81.  ;; (consonant-ext)
  82.  ;; (tone-mark)
  83.  ;; (consonant-or-tone-mark)
  84.  ;; (temporary-escape)
  85.  
  86.  (vowel
  87.   ("a"  ("a├í├áß║ú├úß║í")) ("A"  ("A├ü├Çß║ó├âß║á"))
  88.   ("e"  ("e├⌐├¿ß║╗ß║╜ß║╣")) ("E"  ("E├ë├êß║║ß║╝ß║╕"))
  89.   ("i"  ("i├¡├¼ß╗ë─⌐ß╗ï")) ("I"  ("I├ì├îß╗ê─¿ß╗è"))
  90.   ("o"  ("o├│├▓ß╗Å├╡ß╗ì")) ("O"  ("O├ô├Æß╗Ä├òß╗î"))
  91.   ("u"  ("u├║├╣ß╗º┼⌐ß╗Ñ")) ("U"  ("U├Ü├Öß╗ª┼¿ß╗ñ"))
  92.   ("y"  ("y├╜ß╗│ß╗╖ß╗╣ß╗╡")) ("Y"  ("Y├¥ß╗▓ß╗╢ß╗╕ß╗┤")))
  93.  
  94.  (consonant
  95.   ("b" ?b) ("c" ?c) ("d" ?d) ("g" ?g) ("h" ?h) ("k" ?k) ("l" ?l) ("m" ?m)
  96.   ("n" ?n) ("p" ?p) ("q" ?q) ("t" ?t) ("v" ?v)
  97.   ("B" ?B) ("C" ?C) ("D" ?D) ("G" ?G) ("H" ?H) ("K" ?K) ("L" ?L) ("M" ?M)
  98.   ("N" ?N) ("P" ?P) ("Q" ?Q) ("T" ?T) ("V" ?V))
  99.  ;;Khi cac phu am nay di sau nguyen am thi nen thoat ve tieng Anh
  100.  ;;Should switch to English when these consonants are after any vowel (set temporary-escape)  
  101.  (ending-1st-notviet-consonant ;
  102.   ("q" ?q) ("Q" ?Q) ("d" ?d) ("D" ?D) ("g" ?g) ("G" ?G) ("h" ?h) ("H" ?H)
  103.   ("k" ?k) ("K" ?K) ("l" ?l) ("L" ?L) ("v" ?v) ("V" ?V) ("b" ?b) ("B" ?B) ("z" ?z) ("Z" ?Z))
  104.  ;; These are the consonants that can end a word, anything else is not VNese
  105.  (ending-1st-consonant ; (e.g. tß╗æt, ─æß║╣p, xß║Ñu)
  106.   ("c" ?c) ("m" ?m) ("n" ?n) ("p" ?p) ("t" ?t)
  107.   ("C" ?C) ("M" ?M) ("N" ?N) ("P" ?P) ("T" ?T))
  108.  (ending-2nd-consonant ; Can only go with 'n' or 'c' (e.g. s├│ng, sang, ├¡ch)
  109.   ("g" ?g) ("h" ?h)
  110.   ("G" ?G) ("H" ?H))
  111.  
  112.  (alnum
  113.   ("a" ?a) ("b" ?b) ("c" ?c) ("d" ?d) ("e" ?e) ("f" ?f) ("g" ?g) 
  114.   ("h" ?h) ("i" ?i) ("j" ?j) ("k" ?k) ("l" ?l) ("m" ?m) ("n" ?n)
  115.   ("o" ?o) ("p" ?p) ("q" ?q) ("r" ?r) ("s" ?s) ("t" ?t) ("u" ?u)
  116.   ("v" ?v) ("w" ?w) ("x" ?x) ("y" ?y) ("z" ?z)
  117.   ("A" ?A) ("B" ?B) ("C" ?C) ("D" ?D) ("E" ?E) ("F" ?F) ("G" ?G) 
  118.   ("H" ?H) ("I" ?I) ("J" ?J) ("K" ?K) ("L" ?L) ("M" ?M) ("N" ?N)
  119.   ("O" ?O) ("P" ?P) ("Q" ?Q) ("R" ?R) ("S" ?S) ("T" ?T) ("U" ?U)
  120.   ("V" ?V) ("W" ?W) ("X" ?X) ("Y" ?Y) ("Z" ?Z)
  121.   ("0" ?0) ("1" ?1) ("2" ?2) ("3" ?3) ("4" ?4)
  122.   ("5" ?5) ("6" ?6) ("7" ?7) ("8" ?8) ("9" ?9))
  123.  
  124.  (permanent-escape
  125.   ("\\"))
  126.  
  127.  (backspace
  128.   ((BackSpace) (cond (backspace-is-undo (undo))))))
  129.  
  130. ;; Local Variables:
  131. ;; coding: utf-8
  132. ;; mode: emacs-lisp
  133. ;; End:
  134.